<extend name="./Application/Admin/View/base.html" />
<block name="title"><title><?php echo C(APP_NAME);?>PC端管理</title></block>
<block name="stylesheets">
<link href="__PUBLIC__/assets/css/select2.css" rel="stylesheet">

</block>
<block name="stylecss">
<style type='text/css'>
    table tr td{
        width: 80%;
    }
    table tr th{
        width: 16%;
        text-align: center;
        vertical-align: middle!important;
    }
    .show{
        display: block;
    }
</style>
</block>
<block name="smallmenu">
<ul class="breadcrumb">
	<li>
		<i class="ace-icon fa fa-home home-icon"></i>
		<a href="{:U('Index/index')}">主页</a>
	</li>
    <li>
		<a href="{:U('Examquestion/index')}">考题列表</a>
	</li>
	<li class="active">添加考题信息</li>
</ul><!-- /.breadcrumb -->

<!-- #section:basics/content.searchbox -->
<div class="nav-search" id="nav-search"></div><!-- /.nav-search -->
</block>
<block name="content">
<form action="__CONTROLLER__/examquestion_add" method='post' id='myformedit' class="myformedit" enctype="multipart/form-data">
<input type="hidden" name="action" value="examquestion_add_action">
<div class="row" style="margin-bottom:7px">
    <div class="col-xs-12"><span class="label label-success"><i class="ace-icon fa fa-user bigger-120"></i> 考题信息</span></div>
</div>
<table class="table table-striped table-bordered table-hover" >
    <tr>
        <th>类型标题</th>
        <td><select name="examquestion_examquestiontype_id" id="" class="col-xs-6">
            <option value="">-请选择-</option>
            <volist name="examquestiontype_arr" id="v">
                <option value="{$v.examquestiontype_id}">{$v.examquestiontype_title}</option>
            </volist>
        </select>
        <span class="Validform_checktip">必选项</span>
        </td>
    </tr>
    <tr>
        <th>专业</th>
        <td><select name="examquestion_major_id" id="" class="col-xs-6">
            <option value="">-请选择-</option>
            <option value="1">电吉他</option>
            <option value="2">爵士鼓</option>
            <option value="3">电贝司</option>
        </select>
        <span class="Validform_checktip">必选项</span>
        </td>
    </tr>
    <tr>
        <th>种类</th>
        <td><select name="examquestion_category" id="" class="col-xs-6">
            <option value="">-请选择-</option>
            <option value="1">练习</option>
            <option value="2">考试</option>
        </select>
        <span class="Validform_checktip">必选项</span>
        </td>
    </tr>
    <tr>
        <th>考题内容音频</th>
        <td><div class="naudio_cmt" style="display: inline;">
                <audio class="naudio" preload="preload" controls="" style="display: none;"></audio>
                <div class="naudio_box">
                    <input class="naudio_test " type="file" multiple="multiple" name="audio_file" value=""/>
                </div>
            </div>
        </td>
    </tr>
    <tr>
        <th>考题内容</th>
        <td><!-- 加载编辑器的容器 -->
            <script id="container" name="examquestion_content" type="text/plain"></script>
            <!-- 配置文件 -->
            <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
            <!-- 编辑器源码文件 -->
            <script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
            <!-- 实例化编辑器 -->
            <script type="text/javascript">
                var ue = UE.getEditor('container');
            </script></td>
    </tr>
    <tr>
        <th>类型</th>
        <td><select name="examquestion_type" id="answer_type" class="col-xs-6">
            <option value="">-请选择-</option>
            <option value="1">选择题</option>
            <option value="2">填空题</option>
            <option value="3">视唱题</option>
        </select>
        <span class="Validform_checktip">必选项</span>
        </td>
    </tr>
    <tr>
        <th>考题答案</th>
        <td>
            <select name="examquestion_answer[]" id="answer_sel" style="display:none" >
                <option value="">-请选择-</option>
                <option value="1">①</option>
                <option value="2">②</option>
                <option value="3">③</option>
                <option value="4">④</option>
                <option value="5">⑤</option>
                <option value="6">⑥</option>
                <option value="7">⑦</option>
                <option value="8">⑧</option>
                <option value="9">⑨</option>
            </select>
            <input type="text" name="examquestion_answer[]" id="answer_input" style="display:none" placeholder="如果填空题有多个答案，请用空格隔开" class="col-xs-12">
            <input type="file" name="examquestion_answer" id="answer_file" style="display:none" class="col-xs-12">
        </td>
    </tr>
    <tr>
        <td colspan="2"><button type="submit" class="btn btn-primary">提交</button> <span class="btn" onClick="location.href='{:U('Examquestion/index')}'">返回</span></td>
    </tr>
</table>
</form>
</block>
<block name="scripts">
<script src="__PUBLIC__/assets/js/select2.js"></script>
</block>
<block name="jscript">
<script script="text/javascript">
    $(function(){
        $('#menu_examquestion').addClass('active open');
        $('#menu_examquestion_list').addClass('active');
    });
    $('#answer_type').change(function(){
        if($(this).val() == 0){
            $('#answer_sel').removeClass('show');
            $('#answer_input').removeClass('show');
            $('#answer_file').removeClass('show');
            $('#examquestion_answer').val('');
        }else if($(this).val() == 1){
            $('#answer_sel').addClass('show');
            $('#answer_input').removeClass('show');
            $('#answer_file').removeClass('show');
        }else if($(this).val() == 2){
            $('#answer_sel').removeClass('show');
            $('#answer_input').addClass('show');
            $('#answer_file').removeClass('show');
        }else if($(this).val() == 3){
            $('#answer_sel').removeClass('show');
            $('#answer_input').removeClass('show');
            $('#answer_file').addClass('show');
        }
    });
</script>
<script>
    $(function () {
        $(".naudio_test").change(function () {
            var objUrl = getObjectURL(this.files[0]);
            $(this).parent().prev('.naudio').attr("src", objUrl);
            $(this).parent().prev('.naudio').show();
        });
    });
    function getObjectURL(file) {
        var url = null;
        if (window.createObjectURL != undefined) { // basic
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }
        return url;
    }
</script>

</block>